package wangle.com.testtinker.application;

import android.app.Application;

import com.tencent.tinker.loader.app.ApplicationLike;
import com.tinkerpatch.sdk.TinkerPatch;
import com.tinkerpatch.sdk.loader.TinkerPatchApplicationLike;

import wangle.com.testtinker.FatchPatchHandler;

/**
 *
 * Created by Administrator on 2017/2/8.
 */

public class SimpleApplication extends Application {
    private ApplicationLike tinkerPatchApplicationLike;

    @Override
    public void onCreate() {
        super.onCreate();
        tinkerPatchApplicationLike = TinkerPatchApplicationLike.getTinkerPatchApplicationLike();

        TinkerPatch.init(tinkerPatchApplicationLike)
                .reflectPatchLibrary()
                .setPatchRollbackOnScreenOff(true)
                .setPatchRestartOnSrceenOff(true);
        // 每隔3个小时去访问后台时候有更新,通过handler实现轮训的效果
        new FatchPatchHandler().fetchPatchWithInterval(3);
    }
}
